package application

import (
	"ruoyi-go-echo-ddd/internal/domain/model"
	"ruoyi-go-echo-ddd/internal/domain/service"
	"ruoyi-go-echo-ddd/internal/infrastructure/http/request"

	"github.com/labstack/echo/v4"
)

type SysUserRoleApplication struct {
	UserRoleService service.SysUserRoleService
}

func NewSysUserRoleApplication(u service.SysUserRoleService) *SysUserRoleApplication {
	return &SysUserRoleApplication{
		UserRoleService: u,
	}
}

func (s *SysUserRoleApplication) Insert(e echo.Context, sysUserRole *model.SysUserRole) (*model.SysUserRole, error) {
	return s.UserRoleService.Insert(e.Request().Context(), sysUserRole)
}

func (s *SysUserRoleApplication) Update(e echo.Context, sysUserRole *model.SysUserRole) (int64, error) {
	return s.UserRoleService.Update(e.Request().Context(), sysUserRole)
}

func (s *SysUserRoleApplication) BatchInsert(e echo.Context, list []*model.SysUserRole) ([]int64, error) {
	return s.UserRoleService.BatchInsert(e.Request().Context(), list)
}

func (s *SysUserRoleApplication) SelectById(e echo.Context, id int64) (*model.SysUserRole, error) {
	return s.UserRoleService.SelectById(e.Request().Context(), id)
}

func (s *SysUserRoleApplication) SelectPage(e echo.Context, param *request.CommonPageParam) ([]*model.SysUserRole, int64, int64, error) {
	return s.UserRoleService.SelectPage(e.Request().Context(), param)
}

func (s *SysUserRoleApplication) BatchDelete(e echo.Context, ids []any) (int64, error) {
	return s.UserRoleService.BatchDelete(e.Request().Context(), ids)
}

func (s *SysUserRoleApplication) DeleteByUserId(e echo.Context, userId int64) (int64, error) {
	return s.UserRoleService.DeleteByUserId(e.Request().Context(), userId)
}

func (s *SysUserRoleApplication) DeleteByUserIdList(e echo.Context, ids []int64) (int64, error) {
	return s.UserRoleService.DeleteByUserIdList(e.Request().Context(), ids)
}
